﻿using Wrox.ProCSharp;
using Wrox.ProCSharp.JupiterBank;
using Wrox.ProCSharp.VenusBank;
using static System.Console;

namespace UsingInterfaces
{
    class Program
    {
        static void Main()
        {
            ////把SaverAccount和 GoldAccount对象声明为 IBankAccount的引用
            //IBankAccount venusAccount = new SaverAccount();
            //IBankAccount jupiterAccount = new GoldAccount();

            //venusAccount.PayIn(200);
            //venusAccount.Withdraw(100);
            //WriteLine(venusAccount.ToString());

            //jupiterAccount.PayIn(500);
            //jupiterAccount.Withdraw(600);
            //jupiterAccount.Withdraw(100);
            //WriteLine(jupiterAccount.ToString());

            //派生的接口ITransferBankAccount
            IBankAccount venusAccount = new SaverAccount();
            ITransferBankAccount jupiterAccount = new CurrentAccount();
            venusAccount.PayIn(200);
            jupiterAccount.PayIn(400);
            jupiterAccount.TransferTo(venusAccount, 100);
            WriteLine(venusAccount.ToString());
            WriteLine(jupiterAccount.ToString());
            ReadKey();
        }

    }
}
